<template>
    <div class="setaccount">
       <Header :isBack="isBack" v-bind:title="title"></Header>
       <div class="content">
           <div class="item padding-24 bg-f center-col">
               <img :src="phone" alt="">
               <div class="right flex-column">
                   <p class="fs-32">手机号</p>
                   <p class="color-9">{{phonenum}}</p>
               </div>
           </div>
           <div class="item padding-24 bg-f center-col">
               <img :src="wx" alt="">
               <div class="right flex-column">
                   <p class="fs-32">微信号</p>
                   <p class="color-9" v-if="userinfo.is_wechat==1">{{userinfo.nickname}}</p>
                   <p class="color-9" v-else>立即绑定</p>
               </div>
           </div>
       </div>
    </div>
</template>
<script>
export default {
    data(){
        return{
            isBack:true,
            title:'账号和绑定设置',
            phone:require('../../assets/account/accountphone.png'),
            wx:require('../../assets/account/accountwx.png'),
            phonenum:'',
            wxnum:'',
            userinfo:''
        }
    },
    created(){
        this.getuserinfo()
        
    },
    methods:{
        getuserinfo(){
            var url = this.$host1 + `home/getPersonalMsg`;
            this.$axios.get(url).then(res => {
                console.log(res)
                //return
                if (res.status == 200) {
                let resData = res.data;
                if (resData.code == 200) {
                    this.userinfo=resData.data
                    this.handle(this.userinfo.mobile)
                } else if(resData.code == 0){
                    // this.$router.push('/login');
                }else{
                    this.AlertWin(resData.message);
                }
                }
            }).catch(() => {
                this.AlertWin("网络错误！请稍后重试！");
            });
        },
        handle(param){
            var strlen = param.length;
            //console.log(strlen)
            if(strlen < 9){
                return strlen;
            }
            //console.log(this.phonenum)  
            this.phonenum =param.substring(0,3)+'****'+param.substring(7,11);
            //console.log(param)
        }

    }
}
</script>
<style lang="scss" scoped>
.setaccount{
    .content{
        margin-top: 1rem;
        width: 100%;
        .item{
            height: 1.2rem;
            border-bottom: 0.01rem solid #e9e9e9;
            img{
                width: 0.8rem;
                height: 0.8rem;
                border-radius: 50%;
            }
            .right{
                width: calc(100% - 1rem);
                height: 0.8rem;
                //background-color: greenyellow;
                margin-left: 0.2rem;
            }
        }
    }
}
</style>
